<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <title>小圳博客-账号设置</title>
    <link rel="stylesheet" th:href="@{/css/bootstrap.min.css}">
    <link rel="stylesheet" th:href="@{/css/global.css}"/>
    <link rel="stylesheet" th:href="@{/css/login.css}"/>
</head>
<body>
<div class="nk-container">

    <div class="main">
        <div class="container p-5 mt-3 mb-3">
            <!-- 上传头像 -->
            <h6 class="text-left text-info border-bottom pb-2">上传头像</h6>
            <!--上传到minio-->
            <form class="mt-5" id="uploadForm" method="post" enctype="multipart/form-data"
                  th:action="@{/user/upload}">
                <div class="form-group row mt-4">
                    <label for="head-image" class="col-sm-2 col-form-label text-right">选择头像:</label>
                    <div class="col-sm-10">
                        <div class="custom-file">
                            <input type="file" class="|custom-file-input ${error != null ? 'is-invalid' : ''}|"
                                   id="head-image" name="headerImage" lang="es" required="">
                            <label class="custom-file-label" for="head-image" data-browse="文件">选择一张图片</label>
                            <div class="invalid-feedback" th:text="${error}">
                                该账号不存在!
                            </div>
                        </div>
                    </div>
                </div>
                <div class="form-group row mt-4">
                    <div class="col-sm-2"></div>
                    <div class="col-sm-10 text-center">
                        <button type="submit" class="btn btn-info text-white form-control">立即上传</button>
                    </div>
                </div>
            </form>

            <!-- 修改昵称 -->
            <h6 class="text-left text-info border-bottom pb-2 mt-5">修改昵称</h6>
            <form class="mt-5" method="post" enctype="multipart/form-data" th:action="@{/user/updateNickname}">
                <div class="form-group row mt-4">
                    <label for="nickname" class="col-sm-2 col-form-label text-right">昵称：</label>
                    <div class="col-sm-10">
                        <input  th:class="|form-control ${nicknameMsg!=null?'is-invalid':''}|"
                               id="nickname"
                               name="nickname" placeholder="请输入新昵称!" required>
                        <div class="invalid-feedback" th:text="${nicknameMsg}">
                            该昵称已存在！
                        </div>
                    </div>
                </div>
                <div class="form-group row mt-4">
                    <div class="col-sm-2"></div>
                    <div class="col-sm-10 text-center">
                        <button type="submit" class="btn btn-info text-white form-control">保存昵称</button>
                    </div>
                </div>
            </form>

            <!-- 修改密码 -->
            <h6 class="text-left text-info border-bottom pb-2 mt-5">修改密码</h6>
            <form class="mt-5" method="post" enctype="multipart/form-data" th:action="@{/user/updatePassword}">
                <div class="form-group row mt-4">
                    <label for="old-password" class="col-sm-2 col-form-label text-right">原密码:</label>
                    <div class="col-sm-10">
                        <input type="password" th:class="|form-control ${oldPasswordMsg!=null?'is-invalid':''}|"
                               id="old-password"
                               name="oldPassword" placeholder="请输入原始密码!" required>
                        <div class="invalid-feedback" th:text="${oldPasswordMsg}">
                            密码长度不能小于8位!
                        </div>
                    </div>
                </div>
                <div class="form-group row mt-4">
                    <label for="new-password" class="col-sm-2 col-form-label text-right">新密码:</label>
                    <div class="col-sm-10">
                        <input type="password" th:class="|form-control ${newPasswordMsg!=null?'is-invalid':''}|"
                               id="new-password"
                               name="newPassword" placeholder="请输入新的密码!" required>
                        <div class="invalid-feedback" th:text="${newPasswordMsg}">
                            密码长度不能小于8位!
                        </div>
                    </div>
                </div>
                <div class="form-group row mt-4">
                    <label for="confirm-password" class="col-sm-2 col-form-label text-right">确认密码:</label>
                    <div class="col-sm-10">
                        <input type="password" th:class="|form-control ${confirmPasswordMsg!=null?'is-invalid':''}|"
                               id="confirm-password"
                               name="confirmPassword" placeholder="再次输入新密码!" required>
                        <div class="invalid-feedback" th:text="${confirmPasswordMsg}">
                            两次输入的密码不一致!
                        </div>
                    </div>
                </div>
                <div class="form-group row mt-4">
                    <div class="col-sm-2"></div>
                    <div class="col-sm-10 text-center">
                        <button type="submit" class="btn btn-info text-white form-control">保存密码</button>
                    </div>
                </div>
            </form>

            <a href="#" th:href="@{/}" class="m-teal">不做修改，返回首页</a>
        </div>
    </div>

</div>

<script src="https://code.jquery.com/jquery-3.3.1.min.js" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"
        crossorigin="anonymous"></script>
<script th:src="@{/js/bootstrap.min.js}"></script>
<script th:src="@{/js/global.js}"></script>
<script th:src="@{/js/setting.js}"></script>
<script>
    $(function () {
        bsCustomFileInput.init();
    });
</script>
</body>
</html>